<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="Content-Style-Type"  content="text/css" />
	<meta http-equiv="Content-Script-Type" content="text/javascript" />
	<title>JSmarty Compiler Debugger</title>
	<script type="text/javascript">var JSmarty = {};</script>
	<script type="text/javascript" src="../src/JSmarty_Compiler.js"></script>
	<script type="text/javascript">
	var compiler = new JSmarty.Compiler();

	function exec()
	{
		var text, result;

		if(exec.idmsg == null)
			exec.idmsg = document.getElementById('msg');
		if(exec.idred == null)
			exec.idres = document.getElementById('res');
		if(exec.idtxt == null)
			exec.idtxt = document.getElementById('txt');

		result = compiler._compile_file(exec.idtxt.value);
		exec.idres.innerHTML = result;

		try{ new Function(result); exec.idmsg.innerHTML = 'Success'; }
		catch(e){ exec.idmsg.innerHTML = e; };
	}
	exec.idmsg = null;
	exec.idres = null;
	exec.idtxt = null;
	</script>
</head>
<body>
<textarea id="txt" cols=60 rows=5>
{if $hoge==1}
Hello, World!! Part1.
{elsif $hoge==2}
Hello, World!! Part2.
{elsif $hoge==3}
Hello, World!! Part3.
{else}
Hello, World!! Part4.
{/if}</textarea>
<input type="button" value='EXEC' onclick="exec()" />
<br />
<pre id="res" style='white-space: -moz-pre-wrap; word-wrap: break-word;'></pre>
<div id="msg"></div>
<script>
exec();
</script>
</body>
</html>